/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved. 
 */
package com.icinfo.cloud.provider.punish.ucase.casemain.service.impl;

import com.icinfo.cloud.provider.punish.ucase.casemain.enums.PartiesReasonTypeEnum;
import com.icinfo.cloud.provider.punish.ucase.casemain.mapper.CasePartiesBranchFlowRecordMapper;
import com.icinfo.cloud.provider.punish.ucase.casemain.service.ICaseMainInfoService;
import com.icinfo.cloud.provider.punish.ucase.casemain.service.ICasePartiesBranchFlowRecordService;
import com.icinfo.cloud.provider.punish.ucase.casemain.vo.CaseMainInfoVo;
import com.icinfo.cloud.provider.punish.ucase.casemain.vo.CasePartiesBranchFlowRecordVo;
import com.icinfo.framework.core.service.support.MyBatisServiceSupport;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * 描述: 案件当事人分支流程记录表 case_parties_branch_flow_record 对应的Service接口实现类.<br>
 *
 * @author framework generator
 * @date 2022年05月16日
 */
@Service
@Slf4j
public class CasePartiesBranchFlowRecordServiceImpl extends MyBatisServiceSupport implements ICasePartiesBranchFlowRecordService {
    @Resource
    private CasePartiesBranchFlowRecordMapper casePartiesBranchFlowRecordMapper;
    @Resource
    private ICaseMainInfoService caseMainInfoService;

    /**
     * 【V2.0.0】描述：获取当事人分支流程信息列表
     *
     * @param caseId 案件id
     * @return {@link List <CasePartiesBranchFlowRecordVo>} 当事人分支流程信息列表
     * @author xiangyuyu
     * @date 2022-05-17 15:17
     */
    @Override
    public List<CasePartiesBranchFlowRecordVo> getCasePartiesBranchFlowList(String caseId) {
        List<CasePartiesBranchFlowRecordVo> list = new ArrayList<>();
        CaseMainInfoVo caseMainInfo = caseMainInfoService.getCaseMainInfo(caseId);
        String casePartiesReasonType = caseMainInfo.getCasePartiesReasonType();
        if(PartiesReasonTypeEnum.MULTIPLE_PARTIES.getCode().equals(casePartiesReasonType)){
            list = casePartiesBranchFlowRecordMapper.selectCasePartiesBranchFlowList(caseId);
            return list;
        }
        //不是多当事人时，直接返回null
        return null;
    }
}